* This file reproduces (with few exceptions) all the results in the paper + SI Appendix

clear
clear mata
clear matrix
set more off
scalar drop _all
matrix drop _all
local drop _all
global drop _all

use ACS_PNAS_Data.dta, clear


************
* Figure 1 *
************

xtile reg_shock_tertile=delta_robwork_1_3, nq(3)

twoway (kdensity threat_FO if eduatt==2, lcolor(gs6) bw(.025))  (kdensity threat_FO if eduatt==3, lcolor(gs6) bw(.025) lp(dash))  (kdensity threat_FO if eduatt==1,  lcolor(black) bw(.05) lp(dot) ) , legend(order(1 "Low Edu" 2 "Med Edu" 3 "High Edu") rows(1) region(lcolor(white)) symx(*.75) )  graphregion(fcolor(white) lcolor(white)) yti("")  xti("")   ti(By education level) ylabel(,nogrid)  saving(threat_FO_hist_by_edu.gph , replace)

graph export threat_FO_hist_by_edu.png, replace width(3000)

twoway (kdensity threat_FO if reg_shock_tertile==1, lcolor(gs6) bw(.025))  (kdensity threat_FO if reg_shock_tertile==2, lcolor(gs6) bw(.025) lp(dash))  (kdensity threat_FO if reg_shock_tertile==3,  lcolor(black) bw(.05) lp(dot) ) , ti(By regional shock intensity) legend(order(1 "Low Reg Shock" 2 "Med Reg Shock" 3 "High  Reg Shock") rows(1) region(lcolor(white)) symx(*.75) )  graphregion(fcolor(white) lcolor(white)) yti("") xti("") ylabel(,nogrid) saving(threat_FO_hist_by_regschock.gph , replace)

graph export threat_FO_hist_by_regschock.png, replace width(3000)

graph combine threat_FO_hist_by_regschock.gph threat_FO_hist_by_edu.gph, col(1) xsize(3.4) ysize(3.4) iscale(0.5) imargin(1 1 1 1) graphregion(fcolor(white) color(white) margin(zero)) 

graph export threat_FO_hist_combined.eps, replace 


************
* Figure 2 *
************

cap postclose betas
postfile betas str15 outcome indbeta indse inddf regbeta regse regdf  using "fig2temp.dta", replace

foreach x of varlist permanent goodpay_std hincfel_std jbscr_std lkuemp_std stflife_std stfeco_std stfgov_std stfdem_std {

preserve
keep if `x'!=.
drop d13_indshock_fo_std 
egen d13_indshock_fo_std=std(d13_indshock_fo)
egen delta_robwork_1_3_std=std(delta_robwork_1_3)
egen `x'std=std(`x')

* With individual shocks
ivreg2 `x' CY* NU* eduyrs age female (d13_indshock_fo_std=iv_d13_indshock_fo_std) [pweight=pspwght], first cluster(nuts2_year)
outreg2 using Figure_2.xls, nolabel bracket drop(NU* CY* o.*) bdec(3) e(rkf) append
estimates store ind_`x'	
local b=_b[d13_indshock_fo_std]
local se=_se[d13_indshock_fo_std]
local df=e(Fdf2)
	
* With regional shocks
ivreg2 `x' CY* NU* eduyrs age female   (delta_robwork_1_3_std=iv_mean_delta_1_3)[pweight=pspwght], first cluster(nuts2_year)
outreg2 using Figure_2.xls, nolabel bracket drop(NU* CY* o.*)  bdec(3) e(rkf) append
estimates store reg_`x'
post betas ("`x'") (`b') (`se') (`df') (_b[delta_robwork_1_3_std]) (_se[delta_robwork_1_3_std]) (e(Fdf2))

restore		
}

postclose betas

preserve
use "fig2temp.dta", clear
gen regbetal90=regbeta-invttail(regdf,0.05)*regse
gen regbetah90=regbeta+invttail(regdf,0.05)*regse
gen indbetal90=indbeta-invttail(inddf,0.05)*indse
gen indbetah90=indbeta+invttail(inddf,0.05)*indse
gen regbetal95=regbeta-invttail(regdf,0.025)*regse
gen regbetah95=regbeta+invttail(regdf,0.025)*regse
gen indbetal95=indbeta-invttail(inddf,0.025)*indse
gen indbetah95=indbeta+invttail(inddf,0.025)*indse

save "fig2.dta", replace	
restore
			
***************************************************
* Figure 3, Table S2 - Individual-Level Estimates *
***************************************************
	
cap postclose betas
postfile betas str25 model shock shock_se shockX shockX_se  control control_se  df  using "fig3temp.dta", replace

*1)
reg radical_right_dummy  d13_indshock_fo_std CY* NU* eduyrs age female [pweight=pspwght], cluster(nuts2_year)
outreg2 using Table_S2.xls, nolabel bracket drop(NU* CY* o.*) bdec(3)  replace 
post betas  ("1 OLS") (_b[ d13_indshock_fo_std]) (_se[ d13_indshock_fo_std])  (.) (.) (.) (.) (e(df_r))

*2)
eststo: ivreg2 radical_right_dummy CY* NU* eduyrs age female ( d13_indshock_fo_std=iv_d13_indshock_fo_std)[pweight=pspwght], first savefirst cluster(nuts2_year)
outreg2 using Table_S2.xls, nolabel bracket drop(NU* CY* o.*) bdec(3) e(rkf) append 
post betas  ("2 IV") (_b[ d13_indshock_fo_std]) (_se[ d13_indshock_fo_std]) (.) (.) (.) (.) (e(Fdf2))
est restore _ivreg2_d13_indshock_fo_std
outreg2 using Table_S2.xls, nolabel bracket drop(NU* CY* o.*) bdec(3) e(rkf) append
est drop _ivreg2_d13_indshock_fo_std

*3)	
eststo: ivreg2 radical_right_dummy  CY* NU* eduyrs age female china_shock_13 ( d13_indshock_fo_std=iv_d13_indshock_fo_std) [pweight=pspwght], first savefirst  cluster(nuts2_year)
outreg2 using Table_S2.xls, nolabel bracket drop(NU* CY* o.*) bdec(3) e(rkf) append 
post betas ("3 china") (_b[ d13_indshock_fo_std]) (_se[ d13_indshock_fo_std]) (.) (.)  (_b[china_shock_13]) (_se[china_shock_13])    (e(Fdf2))
est restore _ivreg2_d13_indshock_fo_std
outreg2 using Table_S2.xls, nolabel bracket drop(NU* CY* o.*) bdec(3) e(rkf) append
est drop _ivreg2_d13_indshock_fo_std	
		
*4)	
sum china_shock_13 if e(sample)==1
eststo: ivreg2 radical_right_dummy  CY* NU* eduyrs age female china_shock_13 ( d13_indshock_fo_std shockXchina=iv_d13_indshock_fo_std ivshockXchina) [pweight=pspwght], first savefirst  cluster(nuts2_year)
outreg2 using Table_S2.xls, nolabel bracket drop(NU* CY* o.*) bdec(3) e(rkf) append 
post betas ("4 interaction china") (_b[ d13_indshock_fo_std]) (_se[ d13_indshock_fo_std]) (_b[shockXchina]) (_se[shockXchina]) (_b[china_shock_13]) (_se[china_shock_13])   (e(Fdf2))	
est restore _ivreg2_d13_indshock_fo_std
outreg2 using Table_S2.xls, nolabel bracket drop(NU* CY* o.*) bdec(3) e(rkf) append
est drop _ivreg2_d13_indshock_fo_std		

*5)
eststo: ivreg2 radical_right_dummy eduyrs age female d13_BK_delta_imp_all_std CY* NU* ( d13_indshock_fo_std=iv_d13_indshock_fo_std)[pweight=pspwght], first savefirst cluster(nuts2_year)
post betas ("5 individual offshoring") (_b[ d13_indshock_fo_std]) (_se[ d13_indshock_fo_std]) (.) (.) (_b[d13_BK_delta_imp_all_std]) (_se[		d13_BK_delta_imp_all_std])    (e(Fdf2))
outreg2 using Table_S2.xls, nolabel bracket drop(NU* CY* o.*) bdec(3) e(rkf) append
est restore _ivreg2_d13_indshock_fo_std
outreg2 using Table_S2.xls, nolabel bracket drop(NU* CY* o.*) bdec(3) e(rkf) append
est drop _ivreg2_d13_indshock_fo_std

*6)
eststo: ivreg2 radical_right_dummy eduyrs age female d13_BK_delta_imp_all_std CY* NU* ( d13_indshock_fo_std int_imp_all = iv_d13_indshock_fo_std iv_int_imp_all)[pweight=pspwght], first savefirst cluster(nuts2_year)
post betas ("6 interaction individual offshoring") (_b[ d13_indshock_fo_std]) (_se[ d13_indshock_fo_std]) (_b[int_imp_al]) (_se[int_imp_al])  (_b[d13_BK_delta_imp_all_std]) (_se[d13_BK_delta_imp_all_std])  (e(Fdf2))	
outreg2 using Table_S2.xls, nolabel bracket drop(NU* CY* o.*) bdec(3) e(rkf) append
est restore _ivreg2_d13_indshock_fo_std
outreg2 using Table_S2.xls, nolabel bracket drop(NU* CY* o.*) bdec(3) e(rkf) append
est drop _ivreg2_d13_indshock_fo_std		
		
*7)			
eststo: ivreg2 radical_right_dummy  eduyrs age female  freehms  CY* NU* ( d13_indshock_fo_std=iv_d13_indshock_fo_std) [pweight=pspwght], first cluster(nuts2_year)  savefirst
outreg2 using Table_S2.xls, nolabel bracket drop(NU* CY* o.*) bdec(3) e(rkf) append 
post betas ("7 traditionalism") (_b[ d13_indshock_fo_std]) (_se[ d13_indshock_fo_std]) (.) (.)  (_b[freehms]) (_se[freehms])  (e(Fdf2))			
est restore _ivreg2_d13_indshock_fo_std
outreg2 using Table_S2.xls, nolabel bracket drop(NU* CY* o.*) bdec(3) e(rkf) append
est drop _ivreg2_d13_indshock_fo_std
		
*8)			
sum freehms if e(sample)==1
eststo: ivreg2 radical_right_dummy  CY* NU* eduyrs age female freehms ( d13_indshock_fo_std shockXfreeh=iv_d13_indshock_fo_std ivshockXfreeh )[pweight=pspwght] , first savefirst cluster(nuts2_year)
outreg2 using Table_S2.xls, nolabel bracket drop(NU* CY* o.*) bdec(3) e(rkf) append 
post betas ("8 interaction traditionalism") (_b[ d13_indshock_fo_std]) (_se[ d13_indshock_fo_std]) (_b[shockXfreeh]) (_se[shockXfreeh])  (_b[freehms]) (_se[freehms])  (e(Fdf2))
est restore _ivreg2_d13_indshock_fo_std
outreg2 using Table_S2.xls, nolabel bracket drop(NU* CY* o.*) bdec(3) e(rkf) append
est drop _ivreg2_d13_indshock_fo_std

*9)		
eststo: ivreg2 radical_right_dummy CY* NU* eduyrs age female immig ( d13_indshock_fo_std=iv_d13_indshock_fo_std)[pweight=pspwght], first savefirst cluster(nuts2_year)
outreg2 using Table_S2.xls, nolabel bracket drop(NU* CY* o.*) bdec(3) e(rkf) append 
post betas ("9 nativism") (_b[ d13_indshock_fo_std]) (_se[ d13_indshock_fo_std]) (.) (.)   (_b[immig]) (_se[immig])    (e(Fdf2)) 
est restore _ivreg2_d13_indshock_fo_std
outreg2 using Table_S2.xls, nolabel bracket drop(NU* CY* o.*) bdec(3) e(rkf) append
est drop _ivreg2_d13_indshock_fo_std	

*10)					
sum immig if e(sample)==1
eststo: ivreg2 radical_right_dummy  CY* NU* eduyrs age female immig ( d13_indshock_fo_std shockXimmig=iv_d13_indshock_fo_std ivshockXimmig )[pweight=pspwght] , first savefirst cluster(nuts2_year)
outreg2 using Table_S2.xls, nolabel bracket drop(NU* CY* o.*) bdec(3) e(rkf) append 
post betas ("10 interaction nativism") (_b[ d13_indshock_fo_std]) (_se[ d13_indshock_fo_std]) (_b[shockXimmig]) (_se[shockXimmig])   (_b[immig]) (_se[immig])   (e(Fdf2))	
est restore _ivreg2_d13_indshock_fo_std
outreg2 using Table_S2.xls, nolabel bracket drop(NU* CY* o.*) bdec(3) e(rkf) append
est drop _ivreg2_d13_indshock_fo_std

*11)		
ivreg2 radical_right_dummy  eduyrs age female  status CY* NU* ( d13_indshock_fo_std=iv_d13_indshock_fo_std) [pweight=pspwght], first cluster(nuts2_year)  savefirst
outreg2 using Table_S2.xls, nolabel bracket drop(NU* CY* o.*) bdec(3) e(rkf) append 
post betas ("11 status threat") (_b[ d13_indshock_fo_std]) (_se[ d13_indshock_fo_std]) (.) (.)   (_b[status]) (_se[status])    (e(Fdf2))
est restore _ivreg2_d13_indshock_fo_std
outreg2 using Table_S2.xls, nolabel bracket drop(NU* CY* o.*) bdec(3) e(rkf) append
est drop _ivreg2_d13_indshock_fo_std				
			
*12)
sum status if e(sample)==1
eststo: ivreg2 radical_right_dummy  CY* NU* eduyrs age female status ( d13_indshock_fo_std shockXstatus=iv_d13_indshock_fo_std ivshockXstatus )[pweight=pspwght] , first savefirst cluster(nuts2_year)
outreg2 using Table_S2.xls, nolabel bracket drop(NU* CY* o.*) bdec(3) e(rkf) append 
post betas ("12 interaction status threat") (_b[ d13_indshock_fo_std]) (_se[ d13_indshock_fo_std]) (_b[shockXstatus]) (_se[shockXstatus])   (_b[status]) (_se[status])   (e(Fdf2))
est restore _ivreg2_d13_indshock_fo_std
outreg2 using Table_S2.xls, nolabel bracket drop(NU* CY* o.*) bdec(3) e(rkf) append
est drop _ivreg2_d13_indshock_fo_std
		
postclose betas

preserve
use "fig3temp.dta", clear
foreach var of varlist shock  shockX {
gen `var'l95=`var'-invttail(df,0.025)*`var'_se
gen `var'h95=`var'+invttail(df,0.025)*`var'_se
gen `var'l90=`var'-invttail(df,0.05)*`var'_se
gen `var'h90=`var'+invttail(df,0.05)*`var'_se
}

save "fig3.dta", replace
restore	
  
  
************
* Figure 4 *
************

* Standardizing variables between zero and one:

foreach x of varlist freehms immig status {

	sum `x'
	
	gen `x'_std=(`x'-r(min))/(r(max)-r(min))
	
}
 
cap postclose betas
postfile betas str15 outcome beta se df  using "fig4temp.dta", replace

foreach x of varlist freehms_std immig_std status_std {

	preserve
	keep if `x'!=.
	drop d13_indshock_fo_std 
	egen d13_indshock_fo_std=std(d13_indshock_fo)
	egen delta_robwork_1_3_std=std(delta_robwork_1_3)
	egen `x'std=std(`x')

	ivreg2 `x' CY* NU* eduyrs age female (d13_indshock_fo_std=iv_d13_indshock_fo_std) [pweight=pspwght], first cluster(nuts2_year)
	outreg2 using Figure_4.xls, nolabel bracket drop(NU* CY* o.*) bdec(3) e(rkf) append
	estimates store ind_`x'	
	local b=_b[d13_indshock_fo_std]
	local se=_se[d13_indshock_fo_std]
	local df=e(Fdf2)
	post betas ("`x'") (`b') (`se') (`df') 	
	restore		
}

postclose betas

preserve
use "fig4temp.dta", clear
gen betal95=beta-invttail(df,0.025)*se
gen betah95=beta+invttail(df,0.025)*se
gen betal90=beta-invttail(df,0.05)*se
gen betah90=beta+invttail(df,0.05)*se
save "fig4.dta", replace	
restore


********************************
* Table S3 - Interactive model *
********************************
	
xi: reg  radical_right_dummy CY* NU* eduyrs age female threat_FO iv_d13_indshock_fo [pweight=pspwght],  cluster(nuts2_year)
outreg2 using Table_S3.xls, nolabel bracket drop(NU* CY* o.* _I*) bdec(3) e(rkf) replace


xi: reg radical_right_dummy  i.year NU* eduyrs age female iv_mean_d13_perc_natrob threat_FO iv_d13_indshock_fo [pweight=pspwght],  cluster(nuts2_year)
outreg2 using Table_S3.xls, nolabel bracket drop(NU* CY* o.* _I*) bdec(3) e(rkf) append tex(frag)

	
************
* Table S4 *
************

rename d13_indshock_poo_std d13_shock

*1)
reg radical_right_dummy d13_shock CY* NU* [pweight=pspwght], cluster(nuts2_year)
outreg2 using Table_S4.xls, nolabel bracket drop(NU* CY* o.*) bdec(3) 

*2)
eststo: ivreg2 radical_right_dummy CY* NU* eduyrs age female (d13_shock=iv_d13_indshock_poo_std)[pweight=pspwght], first savefirst cluster(nuts2_year)
outreg2 using Table_S4.xls, nolabel bracket drop(NU* CY* o.*) bdec(3) e(rkf) append
est restore _ivreg2_d13_shock
outreg2 using Table_S4.xls, nolabel bracket drop(NU* CY* o.*) bdec(3) e(rkf) append
est drop _ivreg2_d13_shock

rename d13_shock d13_indshock_poo_std

rename d13_indshock_fo_time_std d13_shock
		
*3)
reg radical_right_dummy d13_shock CY* NU* eduyrs age female [pweight=pspwght], cluster(nuts2_year)
outreg2 using Table_S4.xls, nolabel bracket drop(NU* CY* o.*) bdec(3)  append cti(time)

*4)
eststo: ivreg2 radical_right_dummy CY* NU* eduyrs age female (d13_shock=iv_d13_indshock_fo_time_std)[pweight=pspwght], first savefirst cluster(nuts2_year)
outreg2 using Table_S4.xls, nolabel bracket drop(NU* CY* o.*) bdec(3) e(rkf) append cti(time)

est restore _ivreg2_d13_shock
outreg2 using Table_S4.xls, nolabel bracket drop(NU* CY* o.*) bdec(3) e(rkf) append
est drop _ivreg2_d13_shock		
		
rename d13_shock d13_indshock_fo_time_std 


************
* Table S5 *
************

rename d13_indshock_fo_std d13_shock

reg radical_right_dummy d13_shock CY* NU* eduyrs age female [pweight=pspwght], cluster(nuts2_year)
outreg2 using Table_S5.xls, nolabel bracket drop(NU* CY* o.*) bdec(3) replace

eststo: ivreg2 radical_right_dummy CY* NU* eduyrs age female  (d13_shock=iv_d13_indshock_fo_std)[pweight=pspwght], first savefirst cluster(nuts2_year)
outreg2 using Table_S5.xls, nolabel bracket drop(NU* CY* o.*) bdec(3) e(rkf) append
est restore _ivreg2_d13_shock
outreg2 using Table_S5.xls, nolabel bracket drop(NU* CY* o.*) bdec(3) e(rkf) append
est drop _ivreg2_d13_shock
		
eststo: ivreg2 radical_right_dummy CY* NU* eduyrs age female  (d13_shock=ivusa_nam_d13_fo_std)[pweight=pspwght], first savefirst cluster(nuts2_year)
outreg2 using Table_S5.xls, nolabel bracket drop(NU* CY* o.*) bdec(3) e(rkf) append
est restore _ivreg2_d13_shock
outreg2 using Table_S5.xls, nolabel bracket drop(NU* CY* o.*) bdec(3) e(rkf) append
est drop _ivreg2_d13_shock

eststo: ivreg2 radical_right_dummy CY* NU* eduyrs age female  (d13_shock=ivnoneu_d13_fo_std)[pweight=pspwght], first savefirst cluster(nuts2_year)
outreg2 using Table_S5.xls, nolabel bracket drop(NU* CY* o.*) bdec(3) e(rkf) append
est restore _ivreg2_d13_shock
outreg2 using Table_S5.xls, nolabel bracket drop(NU* CY* o.*) bdec(3) e(rkf) append
est drop _ivreg2_d13_shock
		
eststo: ivreg2 radical_right_dummy CY* NU* eduyrs age female  (d13_shock=ivdp_d13_indshock_fo_std)[pweight=pspwght], first savefirst cluster(nuts2_year)
outreg2 using Table_S5.xls, nolabel bracket drop(NU* CY* o.*) bdec(3) e(rkf) append
est restore _ivreg2_d13_shock
outreg2 using Table_S5.xls, nolabel bracket drop(NU* CY* o.*) bdec(3) e(rkf) append
est drop _ivreg2_d13_shock
		
eststo: ivreg2 radical_right_dummy CY* NU* eduyrs age female  (d13_shock=ivfred_d13_fo_std)[pweight=pspwght], first savefirst cluster(nuts2_year)
outreg2 using Table_S5.xls, nolabel bracket drop(NU* CY* o.*) bdec(3) e(rkf) append
est restore _ivreg2_d13_shock
outreg2 using Table_S5.xls, nolabel bracket drop(NU* CY* o.*) bdec(3) e(rkf) append
est drop _ivreg2_d13_shock
		
eststo: ivreg2 radical_right_dummy CY* NU* eduyrs age female  (d13_shock=ivspec_d13_fo_std)[pweight=pspwght], first savefirst cluster(nuts2_year)
outreg2 using Table_S5.xls, nolabel bracket drop(NU* CY* o.*) bdec(3) e(rkf) append
est restore _ivreg2_d13_shock
outreg2 using Table_S5.xls, nolabel bracket drop(NU* CY* o.*) bdec(3) e(rkf) append
est drop _ivreg2_d13_shock
		
eststo: ivreg2 radical_right_dummy CY* NU* eduyrs age female  (d13_shock=ivtrans_d13_fo_std)[pweight=pspwght], first savefirst cluster(nuts2_year)
outreg2 using Table_S5.xls, nolabel bracket drop(NU* CY* o.*) bdec(3) e(rkf) append
est restore _ivreg2_d13_shock
outreg2 using Table_S5.xls, nolabel bracket drop(NU* CY* o.*) bdec(3) e(rkf) append
est drop _ivreg2_d13_shock

rename d13_shock d13_indshock_fo_std


************
* Table S6 *
************
 
*1)
ivreg2 radical_right_dummy CY* NU* eduyrs age female (d13_indshock_fo_std=iv_d13_indshock_fo_std)[pweight=pspwght], first cluster(nuts2_year)
outreg2 using Table_S6.xls, nolabel bracket drop(NU* CY* o.*) bdec(3) e(rkf) replace
	
*2)
ivprobit radical_right_dummy CY* NU* eduyrs age female (d13_indshock_fo_std=iv_d13_indshock_fo_std)[pweight=pspwght], first vce(cluster nuts2_year)
outreg2 using Table_S6.xls, nolabel bracket drop(NU* CY* o.*) bdec(3) e(rkf) append	
	
* The next command can take more than 24 hours to run. Uncomment only if you have time to run it
*margins, dydx(d13_indshock_fo_std) atmeans pr(pr)
	
*Calculate marginal effect manually

sum radical_right_dummy 
local f=normalden(invnormal(`r(mean)'))
di `f'
lincom _b[d13_indshock_fo_std]*`f'
	
*3)
ivreg2 radical_right_dummy CY* NU* eduyrs age female (d13_indshock_fo_noreg_std=iv_d13_indshock_fo_noreg_std)[pweight=pspwght], first cluster(nuts2_year)
outreg2 using Table_S6.xls, nolabel bracket drop(NU* CY* o.*) bdec(3) e(rkf) append
	
*4)
ivreg2 radical_right_dummy CY* NU* eduyrs age female (d13_indshock_fo_std=iv_d13_indshock_fo_std) [pweight=pspwght] if migrated==0, first cluster(nuts2_year)
outreg2 using Table_S6.xls, nolabel bracket drop(NU* CY* o.*) bdec(3) e(rkf) append

*5)		
ivreg2 radical_right_dummy threat_FO_std CY* NU* eduyrs age female  [pweight=pspwght], first cluster(nuts2_year)
outreg2 using Table_S6.xls, nolabel bracket drop(NU* CY* o.*) bdec(3) e(rkf) append

*6)	
ivreg2 radical_right_dummy CY* NU* eduyrs age female  (d13_reindshock_fo_std=iv_d13_reindshock_fo_std)[pweight=pspwght], first cluster(nuts2_year)
outreg2 using Table_S6.xls, nolabel bracket drop(NU* CY* o.*) bdec(3) e(rkf) append

*7)	
ivreg2 radical_right_dummy CY* NU* eduyrs age female  (d13_indshock_fo_ws_std=iv_d13_indshock_fo_ws_std)[pweight=pspwght], first cluster(nuts2_year)
outreg2 using Table_S6.xls, nolabel bracket drop(NU* CY* o.*) bdec(3) e(rkf) append
	
*8)
ivreg2 radical_right_dummy CY* NU* eduyrs age female  (d13_BK_deltarob_std=iv_d13_BK_deltarob_std)[pweight=pspwght], first cluster(nuts2_year)
outreg2 using Table_S6.xls, nolabel bracket drop(NU* CY* o.*) bdec(3) e(rkf) append	
	
*9)	
ivreg2 radical_right_dummy OCCU* CY* NU* eduyrs age female  (d13_indshock_fo_std=iv_d13_indshock_fo_std) [pweight=pspwght] if unoccupied!=1, first cluster(nuts2_year)
outreg2 using Table_S6.xls, nolabel bracket drop(NU* CY* o.* OCCU*) bdec(3) e(rkf) append

*10)	
ivreg2 radical_right_dummy CY* NU* eduyrs age female  (d13_indshock_fo_std d13_realindshock_fo_std=iv_d13_indshock_fo_std iv_d13_realindshock_fo_std) [pweight=pspwght] if unoccupied!=1, first cluster(nuts2_year)
outreg2 using Table_S6.xls, nolabel bracket drop(NU* CY* o.*) bdec(3) e(rkf) append

*11)
ivreg2 radical_right_dummy CY* NU* eduyrs age female union nilf (d13_indshock_fo_std=iv_d13_indshock_fo_std)[pweight=pspwght], first cluster(nuts2_year)
outreg2 using Table_S6.xls, nolabel bracket drop(NU* CY* o.*) bdec(3) e(rkf) append
	
*12)
ivreg2 radical_right_dummy CY* NU* eduyrs age female (d13_indshock_fo_std=iv_d13_indshock_fo_std)[pweight=pspwght] if east_dummy!=1, first cluster(nuts2_year)
outreg2 using Table_S6.xls, nolabel bracket drop(NU* CY* o.*) bdec(3) e(rkf) append	
	
*13)		
ivreg2 radical_right_dummy CY* NU* eduyrs age female  (d13_indshock_fo_std=iv_d13_indshock_fo_std) [pweight=pspwght] if yrbrn<1980, first cluster(nuts2_year)
outreg2 using Table_S6.xls, nolabel bracket drop(NU* CY* o.*) bdec(3) e(rkf) append
	
*14)
ivreg2 radical_right_dummy CY* NU* eduyrs age female  (d13_indshock_fo_std=iv_d13_indshock_fo_std) [pweight=pspwght] if (nacer11!=34&nacer11!=35&unoccupied!=1), first cluster(nuts2_year)
outreg2 using Table_S6.xls, nolabel bracket drop(NU* CY* o.*) bdec(3) e(rkf) append
	
*15)
ivreg2 radical_right_dummy CY* NU* trendNU* eduyrs age female  (d13_indshock_fo_std=iv_d13_indshock_fo_std) [pweight=pspwght], first cluster(nuts2_year)
outreg2 using Table_S6.xls, nolabel bracket drop(NU* CY* o.* trend*) bdec(3) e(rkf) append

*16) parameters for this specification are generated by a different piece of code


************
* Table S7 *
************

foreach x of varlist radical_left mainstream_left mainstream_right radical_right {

	ivreg2 `x' CY* NU* eduyrs age female (d13_indshock_fo_std=iv_d13_indshock_fo_std) [pweight=pspwght], first cluster(nuts2_year)
	outreg2 using Table_S7.xls, nolabel bracket drop(NU* CY* o.*) bdec(3) e(rkf) append

}
	
